﻿using ProjectCore.Domain.DomainService;
using ProjectCore.Domain.Model.Entity;
using ProjectCore.Domain.Repository.Interfaces;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace ProjectCore.Infrastructure.DomainService
{
   public class AdminDomainService : IAdminDomainService
    {
        private readonly IBaseRepository<Admin> baseRepository;
        public  AdminDomainService(IBaseRepository<Admin> _baseRepository)
        {
            baseRepository = _baseRepository;
        }
        /// <summary>
        /// 获取管理员数据
        /// </summary>
        /// <returns></returns>
        public async Task<List<Admin>> GetAdmins()
        {
            return await baseRepository.LoadEntityAllAsync();
        }
        /// <summary>
        /// 添加管理员
        /// </summary>
        /// <param name="admin"></param>
        /// <returns></returns>
        public async Task<int> Add(Admin admin)
        {
            return await baseRepository.AddEntityAsync(admin);

        }
    }
}
